﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using NHLTester.Classes;

namespace NHLTester.Forms
{
    public partial class ResultForm : Form
    {
        public List<SymulationResult> SymulationResults = new List<SymulationResult>();

        public ResultForm()
        {
            InitializeComponent();
        }

        private void ResultForm_Load(object sender, EventArgs e)
        {
            if (SymulationResults != null)
            {
                if (SymulationResults.Count > 0)
                {
                    ResultGrid.DataSource = SymulationResults;
                    ResultGrid.Refresh();
                    var loose = (from s in SymulationResults select s.StartAccount).Sum();
                    var profit = (from s in SymulationResults select s.FinalAccount).Sum();
                    InputLoose.Text = String.Format("{0:N2} zł", loose);
                    InputProfit.Text = String.Format("{0:N2} zł", profit);
                    InputProfit2.Text = String.Format("{0:N2} zł", profit - loose);
                    InputProfitPercentage.Text = String.Format("{0:N2} %", (profit - loose)/loose * 100);
                }
            }
        }
    }
}
